module.exports = {
    openapi: '3.0.1',
    info: {
        title: 'AutoCost API',
        version: '1.0.0',
        description: 'AutoCost - 汽车费用管理应用后端API',
        contact: {
            name: 'AutoCost Team',
            email: 'support@autocost.com',
        },
    },
    servers: [
        {
            url: 'http://localhost:5001',
            description: 'Development server',
        },
    ],
    paths: {
        '/api/cars': {
            post: {
                summary: '车辆录入',
                tags: ['车辆'],
                security: [{ bearerAuth: [] }],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/CreateCarRequest'
                            }
                        }
                    }
                },
                responses: {
                    201: {
                        description: '创建成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/CarSuccessResponse'
                                }
                            }
                        }
                    },
                    400: {
                        description: '请求参数错误',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            },
            get: {
                summary: '获取车辆列表',
                tags: ['车辆'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'page',
                        schema: {
                            type: 'integer',
                            default: 1
                        },
                        description: '页码'
                    },
                    {
                        in: 'query',
                        name: 'limit',
                        schema: {
                            type: 'integer',
                            default: 10
                        },
                        description: '每页数量'
                    },
                    {
                        in: 'query',
                        name: 'category',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆类型筛选'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/CarListResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/cars/{id}': {
            get: {
                summary: '获取车辆详情',
                tags: ['车辆'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/CarSuccessResponse'
                                }
                            }
                        }
                    },
                    404: {
                        description: '车辆不存在',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            },
            put: {
                summary: '更新车辆信息',
                tags: ['车辆'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    }
                ],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/UpdateCarRequest'
                            }
                        }
                    }
                },
                responses: {
                    200: {
                        description: '更新成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/CarSuccessResponse'
                                }
                            }
                        }
                    },
                    404: {
                        description: '车辆不存在',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            },
            delete: {
                summary: '删除车辆',
                tags: ['车辆'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    }
                ],
                responses: {
                    200: {
                        description: '删除成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/SuccessResponse'
                                }
                            }
                        }
                    },
                    404: {
                        description: '车辆不存在',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/auth/register': {
            post: {
                summary: '用户注册',
                tags: ['认证'],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/RegisterRequest'
                            }
                        }
                    }
                },
                responses: {
                    201: {
                        description: '注册成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/AuthResponse'
                                }
                            }
                        }
                    },
                    400: {
                        description: '注册失败',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/auth/login': {
            post: {
                summary: '用户登录',
                tags: ['认证'],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/LoginRequest'
                            }
                        }
                    }
                },
                responses: {
                    200: {
                        description: '登录成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/AuthResponse'
                                }
                            }
                        }
                    },
                    401: {
                        description: '登录失败',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/auth/profile': {
            get: {
                summary: '获取用户信息',
                tags: ['认证'],
                security: [{ bearerAuth: [] }],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/UserProfileResponse'
                                }
                            }
                        }
                    }
                }
            },
            put: {
                summary: '更新用户信息',
                tags: ['认证'],
                security: [{ bearerAuth: [] }],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/UpdateProfileRequest'
                            }
                        }
                    }
                },
                responses: {
                    200: {
                        description: '更新成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/UserProfileResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/auth/set-default-vehicle': {
            put: {
                summary: '设置默认车辆',
                tags: ['认证'],
                security: [{ bearerAuth: [] }],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/SetDefaultVehicleRequest'
                            }
                        }
                    }
                },
                responses: {
                    200: {
                        description: '设置成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/SetDefaultVehicleResponse'
                                }
                            }
                        }
                    },
                    400: {
                        description: '请求参数错误',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    },
                    404: {
                        description: '车辆不存在',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/auth/get-default-vehicle': {
            get: {
                summary: '获取默认车辆',
                tags: ['认证'],
                security: [{ bearerAuth: [] }],
                responses: {
                    200: {
                        description: '获取成功（包括未设置默认车辆的情况）',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/GetDefaultVehicleResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/expenses': {
            post: {
                summary: '创建费用记录',
                tags: ['费用'],
                security: [{ bearerAuth: [] }],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/CreateExpenseRequest'
                            }
                        }
                    }
                },
                responses: {
                    201: {
                        description: '创建成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseSuccessResponse'
                                }
                            }
                        }
                    }
                }
            },
            get: {
                summary: '获取费用列表',
                tags: ['费用'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'page',
                        schema: {
                            type: 'integer',
                            default: 1
                        },
                        description: '页码'
                    },
                    {
                        in: 'query',
                        name: 'limit',
                        schema: {
                            type: 'integer',
                            default: 10
                        },
                        description: '每页数量'
                    },
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'type',
                        schema: {
                            type: 'string'
                        },
                        description: '费用类型'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseListResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/expenses/{id}': {
            get: {
                summary: '获取费用详情',
                tags: ['费用'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '费用ID'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseSuccessResponse'
                                }
                            }
                        }
                    }
                }
            },
            put: {
                summary: '更新费用记录',
                tags: ['费用'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '费用ID'
                    }
                ],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/UpdateExpenseRequest'
                            }
                        }
                    }
                },
                responses: {
                    200: {
                        description: '更新成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseSuccessResponse'
                                }
                            }
                        }
                    }
                }
            },
            delete: {
                summary: '删除费用记录',
                tags: ['费用'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '费用ID'
                    }
                ],
                responses: {
                    200: {
                        description: '删除成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/SuccessResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/incomes': {
            post: {
                summary: '创建收入记录',
                tags: ['收入'],
                security: [{ bearerAuth: [] }],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/CreateIncomeRequest'
                            }
                        }
                    }
                },
                responses: {
                    201: {
                        description: '创建成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/IncomeSuccessResponse'
                                }
                            }
                        }
                    }
                }
            },
            get: {
                summary: '获取收入列表',
                tags: ['收入'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'page',
                        schema: {
                            type: 'integer',
                            default: 1
                        },
                        description: '页码'
                    },
                    {
                        in: 'query',
                        name: 'limit',
                        schema: {
                            type: 'integer',
                            default: 10
                        },
                        description: '每页数量'
                    },
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/IncomeListResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/incomes/{id}': {
            get: {
                summary: '获取收入详情',
                tags: ['收入'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '收入ID'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/IncomeSuccessResponse'
                                }
                            }
                        }
                    }
                }
            },
            put: {
                summary: '更新收入记录',
                tags: ['收入'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '收入ID'
                    }
                ],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/UpdateIncomeRequest'
                            }
                        }
                    }
                },
                responses: {
                    200: {
                        description: '更新成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/IncomeSuccessResponse'
                                }
                            }
                        }
                    }
                }
            },
            delete: {
                summary: '删除收入记录',
                tags: ['收入'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '收入ID'
                    }
                ],
                responses: {
                    200: {
                        description: '删除成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/SuccessResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/config/expense-types': {
            get: {
                summary: '获取费用类型列表',
                tags: ['系统配置'],
                security: [{ bearerAuth: [] }],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseTypeListResponse'
                                }
                            }
                        }
                    }
                }
            },
            post: {
                summary: '新增费用类型',
                tags: ['系统配置'],
                security: [{ bearerAuth: [] }],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/CreateExpenseTypeRequest'
                            }
                        }
                    }
                },
                responses: {
                    201: {
                        description: '创建成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseTypeSuccessResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/config/expense-types/{id}': {
            put: {
                summary: '修改费用类型',
                tags: ['系统配置'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '费用类型ID'
                    }
                ],
                requestBody: {
                    required: true,
                    content: {
                        'application/json': {
                            schema: {
                                $ref: '#/components/schemas/UpdateExpenseTypeRequest'
                            }
                        }
                    }
                },
                responses: {
                    200: {
                        description: '修改成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseTypeSuccessResponse'
                                }
                            }
                        }
                    }
                }
            },
            delete: {
                summary: '删除费用类型',
                tags: ['系统配置'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'path',
                        name: 'id',
                        required: true,
                        schema: {
                            type: 'string'
                        },
                        description: '费用类型ID'
                    }
                ],
                responses: {
                    200: {
                        description: '删除成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/SuccessResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        // 数据导出相关API
        '/api/export/user-data': {
            get: {
                summary: '导出用户所有数据',
                tags: ['数据导出'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'format',
                        schema: {
                            type: 'string',
                            enum: ['json', 'csv']
                        },
                        description: '导出格式',
                        example: 'json'
                    }
                ],
                responses: {
                    200: {
                        description: '导出成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/UserDataExportResponse'
                                }
                            }
                        }
                    },
                    401: {
                        description: '未授权',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/export/date-range': {
            get: {
                summary: '导出指定时间范围的数据',
                tags: ['数据导出'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'startDate',
                        schema: {
                            type: 'string',
                            format: 'date'
                        },
                        required: true,
                        description: '开始日期',
                        example: '2024-01-01'
                    },
                    {
                        in: 'query',
                        name: 'endDate',
                        schema: {
                            type: 'string',
                            format: 'date'
                        },
                        required: true,
                        description: '结束日期',
                        example: '2024-12-31'
                    },
                    {
                        in: 'query',
                        name: 'dataType',
                        schema: {
                            type: 'string',
                            enum: ['all', 'expenses', 'incomes', 'fuel', 'maintenance', 'repair', 'charging']
                        },
                        description: '数据类型',
                        example: 'all'
                    },
                    {
                        in: 'query',
                        name: 'format',
                        schema: {
                            type: 'string',
                            enum: ['json', 'csv']
                        },
                        description: '导出格式',
                        example: 'json'
                    }
                ],
                responses: {
                    200: {
                        description: '导出成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/DateRangeExportResponse'
                                }
                            }
                        }
                    },
                    400: {
                        description: '参数错误',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ErrorResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/export/expense-report': {
            get: {
                summary: '导出费用统计报告',
                tags: ['数据导出'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'year',
                        schema: {
                            type: 'integer'
                        },
                        description: '年份',
                        example: 2024
                    },
                    {
                        in: 'query',
                        name: 'month',
                        schema: {
                            type: 'integer',
                            minimum: 1,
                            maximum: 12
                        },
                        description: '月份',
                        example: 12
                    },
                    {
                        in: 'query',
                        name: 'format',
                        schema: {
                            type: 'string',
                            enum: ['json', 'csv']
                        },
                        description: '导出格式',
                        example: 'json'
                    }
                ],
                responses: {
                    200: {
                        description: '导出成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseReportExportResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/export/backup': {
            post: {
                summary: '创建数据备份',
                tags: ['数据导出'],
                security: [{ bearerAuth: [] }],
                responses: {
                    200: {
                        description: '备份创建成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/BackupResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        // 图表相关API
        '/api/charts/fuel-trend': {
            get: {
                summary: '获取燃油趋势图表数据',
                tags: ['图表'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/FuelTrendChartResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/charts/expense-trend': {
            get: {
                summary: '获取费用趋势图表数据',
                tags: ['图表'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseTrendChartResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/charts/income-trend': {
            get: {
                summary: '获取收入趋势图表数据',
                tags: ['图表'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/IncomeTrendChartResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/charts/expense-pie': {
            get: {
                summary: '获取费用饼图数据',
                tags: ['图表'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpensePieChartResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/charts/mileage-trend': {
            get: {
                summary: '获取里程趋势图表数据',
                tags: ['图表'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/MileageTrendChartResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        // 统计相关API
        '/api/statistics/expense': {
            get: {
                summary: '获取费用统计',
                tags: ['统计'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseStatisticsResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/statistics/income': {
            get: {
                summary: '获取收入统计',
                tags: ['统计'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/IncomeStatisticsResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/statistics/fuel': {
            get: {
                summary: '获取燃油统计',
                tags: ['统计'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/FuelStatisticsResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/statistics/expense-ratio': {
            get: {
                summary: '获取费用比例统计',
                tags: ['统计'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'vehicleId',
                        schema: {
                            type: 'string'
                        },
                        description: '车辆ID'
                    },
                    {
                        in: 'query',
                        name: 'period',
                        schema: {
                            type: 'string',
                            enum: ['week', 'month', 'year']
                        },
                        description: '统计周期',
                        example: 'month'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/ExpenseRatioStatisticsResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        // 油价相关API
        '/api/oil-price': {
            get: {
                summary: '获取油价数据',
                tags: ['油价'],
                security: [{ bearerAuth: [] }],
                parameters: [
                    {
                        in: 'query',
                        name: 'province',
                        schema: {
                            type: 'string'
                        },
                        description: '省份/地区'
                    }
                ],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/OilPriceResponse'
                                }
                            }
                        }
                    }
                }
            }
        },
        '/api/oil-price-statistics': {
            get: {
                summary: '获取油价统计数据',
                tags: ['油价'],
                security: [{ bearerAuth: [] }],
                responses: {
                    200: {
                        description: '获取成功',
                        content: {
                            'application/json': {
                                schema: {
                                    $ref: '#/components/schemas/OilPriceStatistics'
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    components: {
        securitySchemes: {
            bearerAuth: {
                type: 'http',
                scheme: 'bearer',
                bearerFormat: 'JWT',
            },
        },
        schemas: {
            Car: {
                type: 'object',
                properties: {
                    _id: {
                        type: 'string',
                        description: '车辆ID'
                    },
                    userId: {
                        type: 'string',
                        description: '用户ID'
                    },
                    name: {
                        type: 'string',
                        description: '车辆昵称'
                    },
                    category: {
                        type: 'string',
                        enum: ['小汽车', '电车', '摩托车', '卡车', '其他'],
                        description: '车辆类型'
                    },
                    brand: {
                        type: 'string',
                        description: '品牌'
                    },
                    carModel: {
                        type: 'string',
                        description: '型号'
                    },
                    productionTime: {
                        type: 'number',
                        description: '生产时间（时间戳）'
                    },
                    purchaseTime: {
                        type: 'number',
                        description: '购买时间（时间戳）'
                    },
                    vehicleType: {
                        type: 'string',
                        enum: ['fuel', 'electric', 'motor'],
                        description: '车类型（燃油车、电车、摩托车）'
                    },
                    licensePlate: {
                        type: 'string',
                        description: '车牌号'
                    },
                    notes: {
                        type: 'string',
                        description: '备注'
                    },
                    currentMileage: {
                        type: 'number',
                        description: '当前里程'
                    },
                    fuelCapacity: {
                        type: 'number',
                        description: '油箱容积'
                    },
                    fuelType: {
                        type: 'string',
                        enum: ['#92', '#95', '#98', '柴油', '电', '其他'],
                        description: '燃油类型'
                    },
                    purchasePrice: {
                        type: 'number',
                        description: '购买价格'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币'
                    },
                    batteryCapacity: {
                        type: 'number',
                        description: '电池容量'
                    },
                    mileage: {
                        type: 'number',
                        description: '续航里程'
                    },
                    createdAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '创建时间'
                    },
                    updatedAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '更新时间'
                    }
                },
                required: ['name', 'category', 'brand', 'carModel', 'productionTime', 'purchaseTime', 'vehicleType']
            },
            CreateCarRequest: {
                type: 'object',
                required: ['name', 'category', 'brand', 'carModel', 'productionTime', 'purchaseTime', 'vehicleType'],
                properties: {
                    name: {
                        type: 'string',
                        description: '车辆昵称'
                    },
                    category: {
                        type: 'string',
                        enum: ['小汽车', '电车', '摩托车', '卡车', '其他'],
                        description: '车辆类型'
                    },
                    brand: {
                        type: 'string',
                        description: '品牌'
                    },
                    carModel: {
                        type: 'string',
                        description: '型号'
                    },
                    productionTime: {
                        type: 'number',
                        description: '生产时间（时间戳）'
                    },
                    purchaseTime: {
                        type: 'number',
                        description: '购买时间（时间戳）'
                    },
                    vehicleType: {
                        type: 'string',
                        enum: ['fuel', 'electric', 'motor'],
                        description: '车类型（燃油车、电车、摩托车）'
                    },
                    licensePlate: {
                        type: 'string',
                        description: '车牌号'
                    },
                    notes: {
                        type: 'string',
                        description: '备注'
                    },
                    currentMileage: {
                        type: 'number',
                        description: '当前里程'
                    },
                    fuelCapacity: {
                        type: 'number',
                        description: '油箱容积'
                    },
                    fuelType: {
                        type: 'string',
                        enum: ['#92', '#95', '#98', '柴油', '电', '其他'],
                        description: '燃油类型'
                    },
                    purchasePrice: {
                        type: 'number',
                        description: '购买价格'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币'
                    },
                    batteryCapacity: {
                        type: 'number',
                        description: '电池容量'
                    },
                    mileage: {
                        type: 'number',
                        description: '续航里程'
                    }
                }
            },
            UpdateCarRequest: {
                type: 'object',
                properties: {
                    name: {
                        type: 'string',
                        description: '车辆昵称'
                    },
                    brand: {
                        type: 'string',
                        description: '品牌'
                    },
                    carModel: {
                        type: 'string',
                        description: '型号'
                    },
                    licensePlate: {
                        type: 'string',
                        description: '车牌号'
                    },
                    notes: {
                        type: 'string',
                        description: '备注'
                    },
                    currentMileage: {
                        type: 'number',
                        description: '当前里程'
                    },
                    fuelCapacity: {
                        type: 'number',
                        description: '油箱容积'
                    },
                    fuelType: {
                        type: 'string',
                        enum: ['#92', '#95', '#98', '柴油', '电', '其他'],
                        description: '燃油类型'
                    },
                    purchasePrice: {
                        type: 'number',
                        description: '购买价格'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币'
                    },
                    vehicleType: {
                        type: 'string',
                        enum: ['fuel', 'electric', 'motor'],
                        description: '车类型（燃油车、电车、摩托车）'
                    },
                    batteryCapacity: {
                        type: 'number',
                        description: '电池容量'
                    },
                    mileage: {
                        type: 'number',
                        description: '续航里程'
                    }
                }
            },
            PaginationInfo: {
                type: 'object',
                properties: {
                    page: {
                        type: 'integer',
                        description: '当前页码',
                        example: 1
                    },
                    limit: {
                        type: 'integer',
                        description: '每页数量',
                        example: 10
                    },
                    total: {
                        type: 'integer',
                        description: '总数量',
                        example: 25
                    },
                    totalPages: {
                        type: 'integer',
                        description: '总页数',
                        example: 3
                    }
                }
            },
            CarListData: {
                type: 'object',
                properties: {
                    cars: {
                        type: 'array',
                        items: {
                            $ref: '#/components/schemas/Car'
                        },
                        description: '车辆列表'
                    },
                    pagination: {
                        $ref: '#/components/schemas/PaginationInfo'
                    }
                }
            },
            SuccessResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '操作成功'
                    }
                }
            },
            CarSuccessResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '操作成功'
                    },
                    data: {
                        $ref: '#/components/schemas/Car'
                    }
                }
            },
            CarListResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取车辆列表成功'
                    },
                    data: {
                        $ref: '#/components/schemas/CarListData'
                    }
                }
            },
            ErrorResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: false
                    },
                    message: {
                        type: 'string',
                        description: '错误消息',
                        example: '请求参数错误'
                    }
                }
            },
            // 用户认证相关
            RegisterRequest: {
                type: 'object',
                required: ['username', 'email', 'password'],
                properties: {
                    username: {
                        type: 'string',
                        description: '用户名'
                    },
                    email: {
                        type: 'string',
                        format: 'email',
                        description: '邮箱'
                    },
                    password: {
                        type: 'string',
                        description: '密码'
                    }
                }
            },
            LoginRequest: {
                type: 'object',
                required: ['email', 'password'],
                properties: {
                    email: {
                        type: 'string',
                        format: 'email',
                        description: '邮箱'
                    },
                    password: {
                        type: 'string',
                        description: '密码'
                    }
                }
            },
            AuthResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '登录成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            token: {
                                type: 'string',
                                description: 'JWT令牌'
                            },
                            user: {
                                $ref: '#/components/schemas/User'
                            }
                        }
                    }
                }
            },
            User: {
                type: 'object',
                properties: {
                    _id: {
                        type: 'string',
                        description: '用户ID'
                    },
                    username: {
                        type: 'string',
                        description: '用户名'
                    },
                    email: {
                        type: 'string',
                        description: '邮箱'
                    },
                    createdAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '创建时间'
                    },
                    updatedAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '更新时间'
                    }
                }
            },
            UserProfileResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取用户信息成功'
                    },
                    data: {
                        $ref: '#/components/schemas/User'
                    }
                }
            },
            UpdateProfileRequest: {
                type: 'object',
                properties: {
                    username: {
                        type: 'string',
                        description: '用户名'
                    },
                    email: {
                        type: 'string',
                        format: 'email',
                        description: '邮箱'
                    }
                }
            },
            SetDefaultVehicleRequest: {
                type: 'object',
                required: ['vehicleId'],
                properties: {
                    vehicleId: {
                        type: 'string',
                        description: '车辆ID'
                    }
                }
            },
            SetDefaultVehicleResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '默认车辆设置成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            defaultVehicleId: {
                                type: 'string',
                                description: '默认车辆ID'
                            },
                            vehicle: {
                                type: 'object',
                                properties: {
                                    id: {
                                        type: 'string',
                                        description: '车辆ID'
                                    },
                                    name: {
                                        type: 'string',
                                        description: '车辆昵称'
                                    },
                                    brand: {
                                        type: 'string',
                                        description: '品牌'
                                    },
                                    carModel: {
                                        type: 'string',
                                        description: '型号'
                                    },
                                    licensePlate: {
                                        type: 'string',
                                        description: '车牌号'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            GetDefaultVehicleResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取默认车辆成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            defaultVehicleId: {
                                oneOf: [
                                    {
                                        type: 'string',
                                        description: '默认车辆ID'
                                    },
                                    {
                                        type: 'null',
                                        description: '未设置默认车辆'
                                    }
                                ]
                            },
                            vehicle: {
                                oneOf: [
                                    {
                                        $ref: '#/components/schemas/Car'
                                    },
                                    {
                                        type: 'null',
                                        description: '未设置默认车辆'
                                    }
                                ]
                            }
                        }
                    }
                }
            },
            // 费用相关
            ExpenseStats: {
                type: 'object',
                description: '费用统计信息',
                properties: {
                    distance: {
                        type: 'number',
                        description: '行驶里程（公里）'
                    },
                    fuelConsumptionPer100km: {
                        type: 'number',
                        description: '百公里油耗（升/百公里）'
                    },
                    costPer100km: {
                        type: 'number',
                        description: '百公里费用（元/百公里）'
                    },
                    fuelConsumption: {
                        type: 'number',
                        description: '消耗油量（升）'
                    },
                    previousMileage: {
                        type: 'number',
                        description: '上次里程'
                    },
                    currentMileage: {
                        type: 'number',
                        description: '当前里程'
                    }
                }
            },
            Expense: {
                type: 'object',
                properties: {
                    _id: {
                        type: 'string',
                        description: '费用ID'
                    },
                    userId: {
                        type: 'string',
                        description: '用户ID'
                    },
                    vehicleId: {
                        type: 'string',
                        description: '车辆ID'
                    },
                    type: {
                        type: 'string',
                        enum: ['加油', '保养', '维修', '停车费', '年检', '保险', '罚单', '过路费', '拖车费', '洗车费', '车位费'],
                        description: '费用类型'
                    },
                    mileage: {
                        type: 'number',
                        description: '里程数'
                    },
                    fuelInfo: {
                        type: 'object',
                        description: '加油信息',
                        properties: {
                            showPrice: {
                                type: 'number',
                                description: '表显单价'
                            },
                            actualPrice: {
                                type: 'number',
                                description: '实付单价'
                            },
                            showAmount: {
                                type: 'number',
                                description: '表显金额'
                            },
                            fuelAmount: {
                                type: 'number',
                                description: '加油量'
                            },
                            fuelType: {
                                type: 'string',
                                enum: ['#92', '#95', '#98', '柴油', '电', '其他'],
                                description: '燃油类型'
                            },
                            discountAmount: {
                                type: 'number',
                                description: '优惠金额'
                            },
                            actualAmount: {
                                type: 'number',
                                description: '实付金额'
                            }
                        }
                    },
                    isFull: {
                        type: 'boolean',
                        description: '邮箱是否加满'
                    },
                    isRecord: {
                        type: 'boolean',
                        description: '上次是否记录'
                    },
                    isWarning: {
                        type: 'boolean',
                        description: '油箱灯是否亮'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币',
                        default: 'CNY'
                    },
                    date: {
                        type: 'string',
                        format: 'date',
                        description: '费用日期'
                    },
                    notes: {
                        type: 'string',
                        description: '备注'
                    },
                    location: {
                        type: 'string',
                        description: '费用地点'
                    },
                    odometer: {
                        type: 'number',
                        description: '里程表（保留向后兼容）'
                    },
                    description: {
                        type: 'string',
                        description: '描述（保留向后兼容）'
                    },
                    imageUrl: {
                        type: 'string',
                        description: '图片URL'
                    },
                    createdAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '创建时间'
                    },
                    updatedAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '更新时间'
                    },
                    totalAmount: {
                        type: 'number',
                        description: '虚拟字段：计算总金额'
                    },
                    stats: {
                        $ref: '#/components/schemas/ExpenseStats'
                    }
                },
                required: ['vehicleId', 'type', 'mileage', 'date']
            },
            ExpenseWithStats: {
                type: 'object',
                description: '包含统计信息和时间戳的费用记录',
                allOf: [
                    {
                        $ref: '#/components/schemas/Expense'
                    },
                    {
                        type: 'object',
                        properties: {
                            createdAt: {
                                type: 'number',
                                description: '创建时间戳'
                            },
                            updatedAt: {
                                type: 'number',
                                description: '更新时间戳'
                            },
                            date: {
                                type: 'number',
                                description: '费用日期时间戳'
                            },
                            createdAtTimestamp: {
                                type: 'number',
                                description: '创建时间戳（向后兼容）'
                            },
                            updatedAtTimestamp: {
                                type: 'number',
                                description: '更新时间戳（向后兼容）'
                            },
                            dateTimestamp: {
                                type: 'number',
                                description: '费用日期时间戳（向后兼容）'
                            }
                        }
                    }
                ]
            },
            CreateExpenseRequest: {
                type: 'object',
                required: ['vehicleId', 'type', 'mileage', 'date'],
                properties: {
                    vehicleId: {
                        type: 'string',
                        description: '车辆ID'
                    },
                    type: {
                        type: 'string',
                        description: '费用类型'
                    },
                    mileage: {
                        type: 'number',
                        description: '里程数'
                    },
                    fuelInfo: {
                        type: 'object',
                        properties: {
                            showPrice: {
                                oneOf: [
                                    { type: 'number', description: '表显单价' },
                                    { type: 'string', description: '表显单价（字符串格式）' }
                                ],
                                description: '表显单价'
                            },
                            actualPrice: {
                                oneOf: [
                                    { type: 'number', description: '实付单价' },
                                    { type: 'string', description: '实付单价（字符串格式）' }
                                ],
                                description: '实付单价'
                            },
                            showAmount: {
                                oneOf: [
                                    { type: 'number', description: '表显金额' },
                                    { type: 'string', description: '表显金额（字符串格式）' }
                                ],
                                description: '表显金额'
                            },
                            fuelAmount: {
                                oneOf: [
                                    { type: 'number', description: '加油量' },
                                    { type: 'string', description: '加油量（字符串格式）' }
                                ],
                                description: '加油量'
                            },
                            fuelType: {
                                type: 'string',
                                enum: ['#92', '#95', '#98', '柴油', '电', '其他'],
                                description: '燃油类型'
                            },
                            discountAmount: {
                                oneOf: [
                                    { type: 'number', description: '优惠金额' },
                                    { type: 'string', description: '优惠金额（字符串格式）' }
                                ],
                                description: '优惠金额'
                            },
                            actualAmount: {
                                oneOf: [
                                    { type: 'number', description: '实付金额' },
                                    { type: 'string', description: '实付金额（字符串格式）' }
                                ],
                                description: '实付金额'
                            }
                        },
                        required: ['showPrice', 'showAmount', 'fuelAmount']
                    },
                    isFull: {
                        type: 'boolean',
                        description: '邮箱是否加满',
                        default: false
                    },
                    isRecord: {
                        type: 'boolean',
                        description: '上次是否记录',
                        default: false
                    },
                    isWarning: {
                        type: 'boolean',
                        description: '油箱灯是否亮',
                        default: false
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币',
                        default: 'CNY'
                    },
                    date: {
                        oneOf: [
                            {
                                type: 'string',
                                format: 'date',
                                description: '费用日期（ISO日期格式）'
                            },
                            {
                                type: 'string',
                                pattern: '^\\d+$',
                                description: '费用日期（时间戳字符串）'
                            },
                            {
                                type: 'number',
                                description: '费用日期（时间戳）'
                            }
                        ],
                        description: '费用日期，支持ISO日期格式或时间戳'
                    },
                    notes: {
                        type: 'string',
                        description: '备注'
                    },
                    location: {
                        type: 'string',
                        description: '费用地点'
                    },
                    odometer: {
                        type: 'number',
                        description: '里程表（保留向后兼容）'
                    },
                    description: {
                        type: 'string',
                        description: '描述（保留向后兼容）'
                    },
                    imageUrl: {
                        type: 'string',
                        description: '图片URL'
                    }
                }
            },
            UpdateExpenseRequest: {
                type: 'object',
                properties: {
                    type: {
                        type: 'string',
                        description: '费用类型'
                    },
                    amount: {
                        type: 'number',
                        description: '费用金额'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币'
                    },
                    date: {
                        type: 'string',
                        format: 'date',
                        description: '费用日期'
                    },
                    description: {
                        type: 'string',
                        description: '费用描述'
                    },
                    location: {
                        type: 'string',
                        description: '费用地点'
                    },
                    mileage: {
                        type: 'number',
                        description: '里程数'
                    }
                }
            },
            ExpenseSuccessResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '操作成功'
                    },
                    data: {
                        $ref: '#/components/schemas/ExpenseWithStats'
                    }
                }
            },
            ExpenseListData: {
                type: 'object',
                properties: {
                    expenses: {
                        type: 'array',
                        items: {
                            $ref: '#/components/schemas/ExpenseWithStats'
                        },
                        description: '费用列表'
                    },
                    pagination: {
                        $ref: '#/components/schemas/PaginationInfo'
                    }
                }
            },
            ExpenseListResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取费用列表成功'
                    },
                    data: {
                        $ref: '#/components/schemas/ExpenseListData'
                    }
                }
            },
            // 收入相关
            Income: {
                type: 'object',
                properties: {
                    _id: {
                        type: 'string',
                        description: '收入ID'
                    },
                    userId: {
                        type: 'string',
                        description: '用户ID'
                    },
                    vehicleId: {
                        type: 'string',
                        description: '车辆ID'
                    },
                    type: {
                        type: 'string',
                        description: '收入类型'
                    },
                    amount: {
                        type: 'number',
                        description: '收入金额'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币'
                    },
                    date: {
                        type: 'string',
                        format: 'date',
                        description: '收入日期'
                    },
                    description: {
                        type: 'string',
                        description: '收入描述'
                    },
                    createdAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '创建时间'
                    },
                    updatedAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '更新时间'
                    }
                },
                required: ['vehicleId', 'type', 'amount', 'date']
            },
            CreateIncomeRequest: {
                type: 'object',
                required: ['vehicleId', 'type', 'amount', 'date'],
                properties: {
                    vehicleId: {
                        type: 'string',
                        description: '车辆ID'
                    },
                    type: {
                        type: 'string',
                        description: '收入类型'
                    },
                    amount: {
                        type: 'number',
                        description: '收入金额'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币',
                        default: 'CNY'
                    },
                    date: {
                        type: 'string',
                        format: 'date',
                        description: '收入日期'
                    },
                    description: {
                        type: 'string',
                        description: '收入描述'
                    }
                }
            },
            UpdateIncomeRequest: {
                type: 'object',
                properties: {
                    type: {
                        type: 'string',
                        description: '收入类型'
                    },
                    amount: {
                        type: 'number',
                        description: '收入金额'
                    },
                    currency: {
                        type: 'string',
                        enum: ['CNY', 'USD', 'EUR'],
                        description: '货币'
                    },
                    date: {
                        type: 'string',
                        format: 'date',
                        description: '收入日期'
                    },
                    description: {
                        type: 'string',
                        description: '收入描述'
                    }
                }
            },
            IncomeSuccessResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '操作成功'
                    },
                    data: {
                        $ref: '#/components/schemas/Income'
                    }
                }
            },
            IncomeListData: {
                type: 'object',
                properties: {
                    incomes: {
                        type: 'array',
                        items: {
                            $ref: '#/components/schemas/Income'
                        },
                        description: '收入列表'
                    },
                    pagination: {
                        $ref: '#/components/schemas/PaginationInfo'
                    }
                }
            },
            IncomeListResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取收入列表成功'
                    },
                    data: {
                        $ref: '#/components/schemas/IncomeListData'
                    }
                }
            },
            // 费用类型相关
            ExpenseType: {
                type: 'object',
                properties: {
                    _id: {
                        type: 'string',
                        description: '费用类型ID'
                    },
                    name: {
                        type: 'string',
                        description: '费用类型名称'
                    },
                    code: {
                        type: 'string',
                        description: '费用类型代码'
                    },
                    description: {
                        type: 'string',
                        description: '费用类型描述'
                    },
                    createdAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '创建时间'
                    },
                    updatedAt: {
                        type: 'string',
                        format: 'date-time',
                        description: '更新时间'
                    }
                },
                required: ['name', 'code']
            },
            CreateExpenseTypeRequest: {
                type: 'object',
                required: ['name', 'code'],
                properties: {
                    name: {
                        type: 'string',
                        description: '费用类型名称'
                    },
                    code: {
                        type: 'string',
                        description: '费用类型代码'
                    },
                    description: {
                        type: 'string',
                        description: '费用类型描述'
                    }
                }
            },
            UpdateExpenseTypeRequest: {
                type: 'object',
                properties: {
                    name: {
                        type: 'string',
                        description: '费用类型名称'
                    },
                    description: {
                        type: 'string',
                        description: '费用类型描述'
                    }
                }
            },
            ExpenseTypeSuccessResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '操作成功'
                    },
                    data: {
                        $ref: '#/components/schemas/ExpenseType'
                    }
                }
            },
            ExpenseTypeListData: {
                type: 'object',
                properties: {
                    expenseTypes: {
                        type: 'array',
                        items: {
                            $ref: '#/components/schemas/ExpenseType'
                        },
                        description: '费用类型列表'
                    }
                }
            },
            ExpenseTypeListResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取费用类型列表成功'
                    },
                    data: {
                        $ref: '#/components/schemas/ExpenseTypeListData'
                    }
                }
            },
            // 数据导出相关
            UserDataExportResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '导出成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            user: {
                                type: 'object',
                                description: '用户信息'
                            },
                            vehicles: {
                                type: 'array',
                                description: '车辆列表'
                            },
                            expenses: {
                                type: 'array',
                                description: '费用列表'
                            },
                            incomes: {
                                type: 'array',
                                description: '收入列表'
                            },
                            fuelRecords: {
                                type: 'array',
                                description: '燃油记录列表'
                            },
                            maintenanceRecords: {
                                type: 'array',
                                description: '保养记录列表'
                            },
                            repairRecords: {
                                type: 'array',
                                description: '维修记录列表'
                            },
                            chargingRecords: {
                                type: 'array',
                                description: '充电记录列表'
                            },
                            exportDate: {
                                type: 'string',
                                format: 'date-time',
                                description: '导出时间'
                            },
                            totalRecords: {
                                type: 'object',
                                description: '记录总数统计'
                            }
                        }
                    }
                }
            },
            DateRangeExportResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '导出成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            startDate: {
                                type: 'string',
                                format: 'date',
                                description: '开始日期'
                            },
                            endDate: {
                                type: 'string',
                                format: 'date',
                                description: '结束日期'
                            },
                            dataType: {
                                type: 'string',
                                description: '数据类型'
                            },
                            records: {
                                type: 'array',
                                description: '导出的记录'
                            },
                            summary: {
                                type: 'object',
                                description: '数据摘要'
                            },
                            exportDate: {
                                type: 'string',
                                format: 'date-time',
                                description: '导出时间'
                            }
                        }
                    }
                }
            },
            ExpenseReportExportResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '导出成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            period: {
                                type: 'object',
                                properties: {
                                    startDate: {
                                        type: 'string',
                                        description: '开始日期'
                                    },
                                    endDate: {
                                        type: 'string',
                                        description: '结束日期'
                                    }
                                }
                            },
                            totalExpenses: {
                                type: 'integer',
                                description: '费用记录总数'
                            },
                            totalAmount: {
                                type: 'number',
                                description: '总费用金额'
                            },
                            expenseStats: {
                                type: 'object',
                                description: '费用统计'
                            },
                            vehicleStats: {
                                type: 'object',
                                description: '车辆统计'
                            },
                            expenses: {
                                type: 'array',
                                description: '费用列表'
                            },
                            exportDate: {
                                type: 'string',
                                format: 'date-time',
                                description: '导出时间'
                            }
                        }
                    }
                }
            },
            BackupResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '备份创建成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            backup: {
                                type: 'object',
                                properties: {
                                    version: {
                                        type: 'string',
                                        description: '备份版本'
                                    },
                                    backupDate: {
                                        type: 'string',
                                        format: 'date-time',
                                        description: '备份时间'
                                    },
                                    user: {
                                        type: 'object',
                                        description: '用户信息'
                                    },
                                    data: {
                                        type: 'object',
                                        description: '备份数据'
                                    },
                                    summary: {
                                        type: 'object',
                                        description: '数据摘要'
                                    }
                                }
                            },
                            downloadUrl: {
                                type: 'string',
                                description: '下载链接'
                            }
                        }
                    }
                }
            },
            // 图表相关
            FuelTrendChartResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            labels: {
                                type: 'array',
                                items: {
                                    type: 'string'
                                },
                                description: '时间标签'
                            },
                            datasets: {
                                type: 'array',
                                items: {
                                    type: 'object',
                                    properties: {
                                        label: {
                                            type: 'string',
                                            description: '数据集标签'
                                        },
                                        data: {
                                            type: 'array',
                                            items: {
                                                type: 'number'
                                            },
                                            description: '数据值'
                                        }
                                    }
                                },
                                description: '数据集'
                            },
                            summary: {
                                type: 'object',
                                description: '统计摘要'
                            }
                        }
                    }
                }
            },
            ExpenseTrendChartResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            labels: {
                                type: 'array',
                                items: {
                                    type: 'string'
                                },
                                description: '时间标签'
                            },
                            datasets: {
                                type: 'array',
                                items: {
                                    type: 'object',
                                    properties: {
                                        label: {
                                            type: 'string',
                                            description: '数据集标签'
                                        },
                                        data: {
                                            type: 'array',
                                            items: {
                                                type: 'number'
                                            },
                                            description: '数据值'
                                        }
                                    }
                                },
                                description: '数据集'
                            },
                            summary: {
                                type: 'object',
                                description: '统计摘要'
                            }
                        }
                    }
                }
            },
            IncomeTrendChartResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            labels: {
                                type: 'array',
                                items: {
                                    type: 'string'
                                },
                                description: '时间标签'
                            },
                            datasets: {
                                type: 'array',
                                items: {
                                    type: 'object',
                                    properties: {
                                        label: {
                                            type: 'string',
                                            description: '数据集标签'
                                        },
                                        data: {
                                            type: 'array',
                                            items: {
                                                type: 'number'
                                            },
                                            description: '数据值'
                                        }
                                    }
                                },
                                description: '数据集'
                            },
                            summary: {
                                type: 'object',
                                description: '统计摘要'
                            }
                        }
                    }
                }
            },
            ExpensePieChartResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            labels: {
                                type: 'array',
                                items: {
                                    type: 'string'
                                },
                                description: '费用类型标签'
                            },
                            datasets: {
                                type: 'array',
                                items: {
                                    type: 'object',
                                    properties: {
                                        data: {
                                            type: 'array',
                                            items: {
                                                type: 'number'
                                            },
                                            description: '数据值'
                                        },
                                        backgroundColor: {
                                            type: 'array',
                                            items: {
                                                type: 'string'
                                            },
                                            description: '背景颜色'
                                        }
                                    }
                                },
                                description: '数据集'
                            },
                            summary: {
                                type: 'object',
                                description: '统计摘要'
                            }
                        }
                    }
                }
            },
            MileageTrendChartResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            labels: {
                                type: 'array',
                                items: {
                                    type: 'string'
                                },
                                description: '时间标签'
                            },
                            datasets: {
                                type: 'array',
                                items: {
                                    type: 'object',
                                    properties: {
                                        label: {
                                            type: 'string',
                                            description: '数据集标签'
                                        },
                                        data: {
                                            type: 'array',
                                            items: {
                                                type: 'number'
                                            },
                                            description: '数据值'
                                        }
                                    }
                                },
                                description: '数据集'
                            },
                            summary: {
                                type: 'object',
                                description: '统计摘要'
                            }
                        }
                    }
                }
            },
            // 统计相关
            ExpenseStatisticsResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            totalAmount: {
                                type: 'number',
                                description: '总费用金额'
                            },
                            totalCount: {
                                type: 'integer',
                                description: '费用记录总数'
                            },
                            averageAmount: {
                                type: 'number',
                                description: '平均费用金额'
                            },
                            byType: {
                                type: 'object',
                                description: '按类型统计'
                            },
                            byVehicle: {
                                type: 'object',
                                description: '按车辆统计'
                            },
                            byMonth: {
                                type: 'object',
                                description: '按月统计'
                            },
                            period: {
                                type: 'object',
                                properties: {
                                    startDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '开始日期'
                                    },
                                    endDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '结束日期'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            IncomeStatisticsResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            totalAmount: {
                                type: 'number',
                                description: '总收入金额'
                            },
                            totalCount: {
                                type: 'integer',
                                description: '收入记录总数'
                            },
                            averageAmount: {
                                type: 'number',
                                description: '平均收入金额'
                            },
                            byType: {
                                type: 'object',
                                description: '按类型统计'
                            },
                            byVehicle: {
                                type: 'object',
                                description: '按车辆统计'
                            },
                            byMonth: {
                                type: 'object',
                                description: '按月统计'
                            },
                            period: {
                                type: 'object',
                                properties: {
                                    startDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '开始日期'
                                    },
                                    endDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '结束日期'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            FuelStatisticsResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            totalFuelAmount: {
                                type: 'number',
                                description: '总燃油费用'
                            },
                            totalFuelVolume: {
                                type: 'number',
                                description: '总燃油量'
                            },
                            averageFuelConsumption: {
                                type: 'number',
                                description: '平均油耗'
                            },
                            totalMileage: {
                                type: 'number',
                                description: '总里程'
                            },
                            fuelEfficiency: {
                                type: 'number',
                                description: '燃油效率'
                            },
                            byVehicle: {
                                type: 'object',
                                description: '按车辆统计'
                            },
                            byMonth: {
                                type: 'object',
                                description: '按月统计'
                            },
                            period: {
                                type: 'object',
                                properties: {
                                    startDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '开始日期'
                                    },
                                    endDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '结束日期'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            ExpenseRatioStatisticsResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '操作是否成功',
                        example: true
                    },
                    message: {
                        type: 'string',
                        description: '响应消息',
                        example: '获取成功'
                    },
                    data: {
                        type: 'object',
                        properties: {
                            totalExpenses: {
                                type: 'number',
                                description: '总费用'
                            },
                            expenseRatios: {
                                type: 'array',
                                items: {
                                    type: 'object',
                                    properties: {
                                        type: {
                                            type: 'string',
                                            description: '费用类型'
                                        },
                                        amount: {
                                            type: 'number',
                                            description: '费用金额'
                                        },
                                        percentage: {
                                            type: 'number',
                                            description: '占比百分比'
                                        }
                                    }
                                },
                                description: '费用比例列表'
                            },
                            byVehicle: {
                                type: 'object',
                                description: '按车辆的费用比例'
                            },
                            period: {
                                type: 'object',
                                properties: {
                                    startDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '开始日期'
                                    },
                                    endDate: {
                                        type: 'string',
                                        format: 'date',
                                        description: '结束日期'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            // 油价相关类型定义
            OilPriceData: {
                type: 'object',
                properties: {
                    province: {
                        type: 'string',
                        description: '省份/地区'
                    },
                    price92: {
                        type: 'number',
                        description: '92号汽油价格'
                    },
                    price95: {
                        type: 'number',
                        description: '95号汽油价格'
                    },
                    price98: {
                        type: 'number',
                        description: '98号汽油价格'
                    },
                    price0: {
                        type: 'number',
                        description: '0号柴油价格'
                    },
                    updateTime: {
                        type: 'string',
                        format: 'date-time',
                        description: '更新时间'
                    },
                    source: {
                        type: 'string',
                        description: '数据来源'
                    }
                },
                required: ['province', 'price92', 'price95', 'price98', 'price0', 'updateTime', 'source']
            },
            OilPriceResponse: {
                type: 'object',
                properties: {
                    success: {
                        type: 'boolean',
                        description: '请求是否成功'
                    },
                    message: {
                        type: 'string',
                        description: '响应消息'
                    },
                    data: {
                        type: 'array',
                        items: {
                            $ref: '#/components/schemas/OilPriceData'
                        },
                        description: '油价数据列表'
                    },
                    lastUpdate: {
                        type: 'string',
                        format: 'date-time',
                        description: '最后更新时间'
                    },
                    totalCount: {
                        type: 'number',
                        description: '数据总数'
                    }
                }
            },
            OilPriceStatistics: {
                type: 'object',
                properties: {
                    nationalAverage: {
                        type: 'object',
                        properties: {
                            price92: { type: 'number', description: '92号汽油平均价格' },
                            price95: { type: 'number', description: '95号汽油平均价格' },
                            price98: { type: 'number', description: '98号汽油平均价格' },
                            price0: { type: 'number', description: '0号柴油平均价格' }
                        }
                    },
                    highestPrice: {
                        type: 'object',
                        properties: {
                            province: { type: 'string', description: '最高价格地区' },
                            price92: { type: 'number', description: '92号汽油最高价格' },
                            price95: { type: 'number', description: '95号汽油最高价格' },
                            price98: { type: 'number', description: '98号汽油最高价格' },
                            price0: { type: 'number', description: '0号柴油最高价格' }
                        }
                    },
                    lowestPrice: {
                        type: 'object',
                        properties: {
                            province: { type: 'string', description: '最低价格地区' },
                            price92: { type: 'number', description: '92号汽油最低价格' },
                            price95: { type: 'number', description: '95号汽油最低价格' },
                            price98: { type: 'number', description: '98号汽油最低价格' },
                            price0: { type: 'number', description: '0号柴油最低价格' }
                        }
                    }
                }
            }
        }
    },
    security: [
        {
            bearerAuth: [],
        },
    ],
}; 